import { Injectable } from '@angular/core';
import { Http,HttpModule} from '@angular/http';
import { Observable } from 'rxjs/Rx';
import 'rxjs/Rx';
import 'rxjs/add/operator/catch';

@Injectable()
export class DataService {
//   baseUrl="http://192.168.0.123:5000/"
   baseUrl="/comm/";
  constructor(
    public http:Http
  ) { }



//获取验证码
  getCode(mobile){
    return this.http.get(this.baseUrl+`ccp/getcode?Mobile=${mobile}`).map(res=>res.json());
}
//绑定手机
 bindMobile(mobile,code){
  return this.http.post(this.baseUrl+'ccp/bindMobile',{Mobile:mobile,code:code}).map(res=>res.json());
 }
 //获取红包金额
 getRedPacketDetail(mobile){

 }
 //领取红包
receiveRedPacket(mobile){

}
//test
test(){
  return this.http.get('testdata.json')
  .map(res=>res.json())
  .catch((error:any) => Observable.throw(error || 'Server error'));
}
}
